<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "address".
 *
 * @property integer $id
 * @property integer $user_id
 * @property string $name
 * @property integer $province
 * @property integer $city
 * @property integer $district
 * @property string $address_detail
 * @property string $phone
 * @property string $tel
 * @property string $zip_code
 * @property string $remark
 * @property integer $is_default
 * @property integer $is_show
 * @property string $create_time
 * @property string $update_time
 */
class Address extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'address';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'name', 'province', 'city', 'district', 'address_detail', 'phone', 'tel', 'zip_code', 'remark', 'create_time', 'update_time'], 'required'],
            [['user_id', 'province', 'city', 'district', 'is_default', 'is_show'], 'integer'],
            [['create_time', 'update_time'], 'safe'],
            [['name'], 'string', 'max' => 50],
            [['address_detail', 'remark'], 'string', 'max' => 255],
            [['phone', 'tel'], 'string', 'max' => 100],
            [['zip_code'], 'string', 'max' => 20],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => 'user_id',
            'name' => '收货人姓名',
            'province' => '省份',
            'city' => '城市',
            'district' => '地区',
            'address_detail' => '详细地址',
            'phone' => '手机号',
            'tel' => '固定电话',
            'zip_code' => '邮政编码',
            'remark' => '备注',
            'is_default' => '1默认地址2其它地址',
            'is_show' => '显示1显示2删除',
            'create_time' => '创建时间',
            'update_time' => '更新时间',
        ];
    }
}
